<template>
  <div class="page-container">
    <page-tools>
      <template #left>
        <span>总记录数: {{ total }} 条</span>
      </template>
      <template #right>
        <el-button type="primary" size="mini" @click="addShop">新增门店</el-button>
      </template>
    </page-tools>

    <el-card v-loading="isLoading" style="margin-top: 10px;">
      <el-table :data="shopList" border>
        <el-table-column label="序号" type="index" fixed="left" width="60" sortable />
        <el-table-column label="店名" prop="shop_name" width="80" />
        <el-table-column label="所在城市" prop="city_name" width="110" sortable />
        <el-table-column label="具体地址" prop="address" />
        <el-table-column label="店长姓名" prop="shopowner" width="80" />
        <el-table-column label="店长手机号" prop="mobile" width="110" />
        <el-table-column label="开店时间" prop="create_time" width="110" sortable>
          <template #default="{ row }">{{ row.create_time | formatTime }}</template>
        </el-table-column>
        <el-table-column label="营业时间" prop="create_time" width="110">
          <template #default="{ row }">{{ row.open_time }} - {{ row.close_time }}</template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" width="200">
          <template #default="{ row }">
            <el-button
              type="text"
              size="small"
              @click="$router.push(`/employees/detail/${row.id}`)"
            >编辑</el-button>
            <el-button type="text" size="small" @click="clickDel(row.id)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页组件 -->
      <!-- <div style="height: 60px; margin-top: 10px">
        <el-pagination
          :current-page="page"
          :page-sizes="[10, 20, 30, 50, 100]"
          :page-size="size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>-->
    </el-card>
  </div>
</template>

<script>
import { formatTime } from '@/filters/index'
import request from '@/api/wx'
export default {
  name: 'ShopInfo',
  components: {},
  filters: {
    formatTime
  },
  props: {},
  data() {
    return {
      isLoading: false,
      page: 1,
      size: 10,
      total: 0,
      shopList: []
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getShopList()
  },
  mounted() {},
  methods: {
    async getShopList() {
      const res = await request('admin_getShops')
      this.shopList = res.list
      this.total = res.total
    },
    addShop() {},
    clickDel() {},
    // indexMethod(index) {
    //   return index + 1 + (this.page - 1) * this.size
    // },
    handleSizeChange() {},
    handleCurrentChange() {}
  }
}
</script>

<style lang="scss" scoped>
</style>
